while let Some(path) = cur {
let manifest = path.join("Cargo.toml");
debug!("find_root - trying {}", manifest.display());
- if let Ok(pkg) = self.packages.load(&manifest) {
- match *pkg.workspace_config() {
+ if manifest.exists() {
+ match *self.packages.load(&manifest)?.workspace_config() {
WorkspaceConfig::Root { .. } => {
debug!("find_root - found");
return Ok(Some(manifest))
assert_that(p.cargo("test").args(&["-p", "bar"]),
execs().with_status(0));
}
+
+#[test]
+fn error_if_parent_cargo_toml_is_invalid() {
+ let p = project("foo")
+ .file("Cargo.toml", "Totally not a TOML file")
+ .file("bar/Cargo.toml", r#"
+ [project]
+ name = "bar"
+ version = "0.1.0"
+ authors = []
+ "#)
+ .file("bar/src/main.rs", "fn main() {}");
+ p.build();
+
+ assert_that(p.cargo("build").cwd(p.root().join("bar")),
+ execs().with_status(101)
+ .with_stderr_contains("\
+[ERROR] failed to parse manifest at `[..]`"));
+}